<?php echo $this->render("header.phtml"); ?>
<label class="title">Article management  -  all articles published</label>
<div class="horiz_sep">&nbsp;</div>
<table cellpadding="0" cellspacing="0" width="100%" border="0">
	<tr>
		<!-- td align="left">
			<a href="<? echo $this -> baseUrl ?>/<?= $this->contextPath ?>/add-article">Add a new article</a>
		</td -->		
		<td align="right">
			<?php echo $this->page_title;?>
		</td>	
	</tr>
</table>
<?php $utilities = $this->utilities; ?>
<table cellpadding="0" cellspacing="0" width="100%" border="0">
<?php 
	foreach ($this->listArticles as $article) {
		$article_title = $utilities->cv2urltitle(htmlspecialchars ($article->art_title));				
		$param = $article->art_id."-".$this->currentPage."-".str_ireplace(" ", "-", $article_title);
?>
<tr>
	<td style="padding-top: 5px;">
		<table cellpadding="5" cellspacing="0" width="100%" border="0" style="border: 1px solid #81d2f6;">
			<tr style="background-color: #81d2f6;">
				<td align="right">	
					<a href="javascript:eway.confirm('<? echo $this -> baseUrl ?>/<?= $this->contextPath ?>/unpublished-article/<?php echo $param;?>', 'Are you sure you want to unpublic this article?');">Unpublished</a>
					&nbsp;&nbsp;
					<a href="<? echo $this -> baseUrl ?>/<?= $this->contextPath ?>/edit-article/<?php echo $param;?>">Edit</a>
					&nbsp;&nbsp;
					<a href="javascript:eway.confirm('<? echo $this -> baseUrl ?>/<?= $this->contextPath ?>/delete-article/<?php echo $param;?>', 'Are you sure you want to delete this article?');">Delete</a>
				</td>
			</tr>
		  	<tr>
		    	<td>
		    		<a href="<? echo $this -> baseUrl ?>/<?= $this->contextPath ?>/view-article/<?php echo $param;?>">
		    			<?php echo $article->art_title;?>
		    		</a>    		
		    	</td>    	
		  	</tr>
		  	<tr>
		  		<td valign="top">
		  			<table cellpadding="0" cellspacing="0" width="100%" border="0">
		  				<tr>
		  					<td>
		  						<?php 
		  							if ($article->art_has_image){
		  								if (strlen($article->art_image)){
		  						?>
		  							<table cellpadding="0" cellspacing="5" align="left">
		  								<tr>
		  									<td>
		  										<img style="border:1px solid #cecece; padding:1px;" src="<?php echo $this->baseUrl;?>/public/images/article/<?php echo $article->art_image;?>"/>
		  									</td>
		  								</tr>
		  							</table>
		  						<?php 
		  								}
		  							} 
		  						?>
		  						<?php if ($article->art_lead) echo $utilities->substring($article->art_lead);?>
		  					</td>
		  				</tr>
		  			</table>
		  		</td>
		  	</tr>
		</table>
	</td>
</tr>
<?php } ?>  
<tr>
	<td align="center">
		<?php echo $this->page; ?>
	</td>
</tr>
</table>
<?php echo $this->render("footer.phtml"); ?>